{include file="common/head"/}
<div style="margin: 15px;" class="fadeInUp animated">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>添加市</legend>
    </fieldset>    
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">所属省</label>
            <div class="layui-input-4">
                <select name="pid" lay-verify="required" lay-filter="pid" >
                    <option value="">请选择省份</option>
                    {volist name="province" id="vo"}
                        <option value="{$vo.id}">{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">市名称</label>
            <div class="layui-input-4">
                <input type="text" maxlength="10" name="name" lay-verify="required" placeholder="请输入市名称" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" id="submit" class="layui-btn" lay-submit="" lay-filter="auth">{:lang('submit')}</button>
                <a href="{:url('index')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,layer = layui.layer,$= layui.jquery;
        form.on('submit(auth)', function (data){
			$("#submit").attr({ disabled: "disabled" });
			var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("",data.field,function(res){
                layer.close(loading);
				if(res.errorCode == 8888){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        location.href = res.url;
                    });
                }else{
					$("#submit").removeAttr("disabled");
                    layer.msg(res.msg,{time:1000,icon:2});
                }
            });
        })
    });
</script>